﻿using System.ComponentModel;
using Util;

namespace IterationLife.ContentResources.Enums
{
    /// <summary>
    /// 内容资源类型
    /// </summary>
    public enum ContentResourceType
    {
        /// <summary>
        /// 文章
        /// </summary>
        [Description("文章")]
        Article = 1,
        /// <summary>
        /// 视频
        /// </summary>
        [Description("视频")]
        Video=2,
        /// <summary>
        /// 图集
        /// </summary>
        [Description("图集")]
        Atlas= 3
    }

    /// <summary>
    /// 内容资源类型枚举扩展
    /// </summary>
    public static class ContentResourceTypeExtensions
    {
        /// <summary>
        /// 获取描述
        /// </summary>
        public static string Description(this ContentResourceType? type)
        {
            return type == null ? string.Empty : type.Value.Description();
        }

        /// <summary>
        /// 获取值
        /// </summary>
        public static int? Value(this ContentResourceType? type)
        {
            return type?.Value();
        }
    }
}
